<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">

<head>
  <title></title>
  <meta charset="utf-8">
  <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  <link rel="stylesheet" href="css/fonts/font-awesome.min.css">
  <link rel="stylesheet" href="css/ui-box.css">
  <link rel="stylesheet" href="css/ui-base.css">
  <link rel="stylesheet" href="css/ui-color.css">
  <link rel="stylesheet" href="css/appcan.icon.css">
  <link rel="stylesheet" href="css/appcan.control.css">
  <link rel="stylesheet" href="css/BaggageTrace.css?v=124">
  <link rel="stylesheet" href="css/base.css">

</head>

<body class="um-vp bc-bg bcF8F8F8" ontouchstart>
    
  <!--遮罩-->
  <div id="zhezhao" class="zhezhao" style="display: none;">
        
  </div>
  <img src="images/bg.png" style="display:none;" />    
    <canvas id = "watermark" width = "200px"  height = "100px" style="display:none;"></canvas>
    <canvas id = "repeat-watermark"></canvas>
  <!-- 主体内容开始 -->
  <main class="bor9B9B9B pre top10 main_wrap">
    
     <!-- 证件号 -->
    <section class="ub ub-ac bor_bot_E7E7E7 h25 bcFFF">
      <p class="icons_style icons_src_BT_IDNumber ml5"></p>
      <input id="idNumber" class="ml5 bor_none h20 fs9 db ub-f1 pl10" type="text" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')" value="" placeholder="请输入证件号" maxlength="18">
      <!-- <div  class="ub-f1 tx-r pr10 cred">*</div> -->
    </section>

    <p class="bor_bot_E7E7E7 h25 lh25 bcFFF tx-c fs10" id="">
      或
    </p>
    <!-- 行李号 -->
    <section class="ub ub-ac bor_bot_E7E7E7 h25 bcFFF" id="name_wrap">
      <p class="icons_style icons_src_BT_card ml5"></p>
      <input id="bagNo" class="ml5 bor_none h20 fs9 db ub-f1 pl10" type="text" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" value="" placeholder="请输入行李号牌" maxlength="10">
      <p id="QRcodeBtn" class="icons_style icons_src_BT_QRcode mr5"></p>
    </section>
    <!-- 时间选择 -->
    <section class="ub ub-ac h25 bcFFF">
      <p class="icons_style icons_src_BT_date ml5"></p>
      <div id="selectDate" class="ml5 lh20 fs9 ub-f1 pl10" type="text"></div>
      <div  class="tx-r pr10 cred">*</div>
    </section>
  </main>
  <!-- 主体内容结束 -->
  <!--查询按钮开始-->
  <button class="bc3BBBD7 fs10 cfff pre top10" id="BaggageQuery">
    行李查询
  </button>
  <!--查询按钮结束-->
  <section class="mat mt10 c9B9B9B wtp95 fs8 mt40">
  <strong class="h20 lh20">温馨提示:</strong>
  <em style="display:block" class="h20 lh20">以上列表信息可能未及时更新,如果有其它问题可至服务中心咨询</em>
  </section>

</body>
<script src="js/appcan.js"></script>
<script src="js/appcan.control.js"></script>
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/z_API.js"></script>
<script src="js/talkingdata.js"></script>
<script>

var http = appcan.locStorage.getVal("baggageHttp");
appcan.ready(function() {
    appcan.window.openToast("正在判断您的权限",-1,5,0);
    //$('body').prepend('<img src="images/bg.png" /><canvas id = "watermark" width = "200px"  height = "100px" style="display:none;"></canvas><canvas id = "repeat-watermark"></canvas>');
    iG.bgm();
    $("#zhezhao").show();
     uexWindow.evaluateScript("", "0", "closezhezhao(1)");
     panduan();
    //查询按钮
    appcan.button("#BaggageQuery", " btn-act", function() {
        
        searchBaggageData();
    });


    //二维码扫描
    $("#QRcodeBtn").click(function(){
     
        uexScanner.open();
        uexScanner.cbOpen = function(opId,dataType,data){
            data = JSON.parse(data);
            $("#bagNo").val(data.code);
            searchBaggageData();
       }

    });

});

    //设置日期
var flightDate = getNowDate();
    $("#selectDate").html(flightDate);
    $("#selectDate").click(function(){
        pickerDate("#selectDate",function(date){
        flightDate = date;
    });

});

/* @[Function] searchBaggageData         查询方法
 * @[Function Object]   AJAXRequestData  请求数据对象
 * @[Variable] [String]    url  请求地址
 * @[Variable] [Object]    param 请求参数对象     
 * @[Variable] [String]    idNumber 证件号
 * @[Variable] [String]    bagNo   行李编号
 */
function searchBaggageData() {
    IC.talkingDataCount("行李服务", "16");

    var url = "";
    var param = {};
    var idNumber = $("#idNumber").val();
    idNumber = idNumber.toUpperCase();
    var bagNo = $("#bagNo").val();
    //操作备注
    var remark = "";
    if (flightDate == "") {
        alerts("日期为必选项");
        return false;
    }
    if (idNumber && bagNo) {
        alerts("证件号和行李号输入任意一项即可");
        return false;
    } else if (bagNo) {
        url = http + "zyh_queryBaggage"
        param = {
            bagNo : bagNo,
            flightDate : flightDate,
            token : token
        }

        remark = "行李号:" + bagNo + ",航班日期:" + flightDate + ",操作时间:" + getNowDateHourMinutes();
        operatingRecord(userName, "行李查询:行李号查询", remark);
    } else if (idNumber) {
        url = http + "zyh_queryByPassenger"
        param = {
            
            idNumber : idNumber,
            flightDate : flightDate,
            token : token
        }

        remark = "证件号:" + idNumber + ",航班日期:" + flightDate + ",操作时间:" + getNowDateHourMinutes();
        operatingRecord(userName, "行李查询:证件号查询", remark);
    } else {
        
        alerts("请输入证件号或者行号");
        return false;
    }

    toasts("正在努力加载中...");

    var res = new AJAXRequestData({
        url : url,
        type : "POST",
        data : param,
    }, function(res) {
         
        appcan.window.closeToast();
        appcan.locStorage.setVal("baggageList", res);
        appcan.window.open({
            name : "BaggageListPage",
            dataType : 0,
            aniId : 5,
            data : "BaggageListPage.html",
        });
    });
}
 
 function panduan(){
        var loginName = localStorage['MU30-lOGIN-USRNAME'];
        var loginUrl="http://mpservice.ceair.com/mpservice/login_mpservice.action?loginName="+loginName;
        $.ajax({
          url: "http://mpservice.ceair.com/mpservice/login_mpservice.action?loginName="+loginName,
          type: "GET",
          dataType: "JSON",
          success: function(res) {
            try{ 
                 if(res.status!=3){
                     var str=res.array.AppRole;
                     if(str.indexOf("22") <= -1){
                         appcan.window.open({
                             name : "authorityTip_win",
                             dataType : 0,
                             aniId : 5,
                             data : "authorityTip_win.html",
                         });                         
                    }
                 }else{
                      appcan.window.open({
                             name : "authorityTip_win",
                             dataType : 0,
                             aniId : 5,
                             data : "authorityTip_win.html",
                         });  
                 }
                //console.log(res);
                 appcan.window.closeToast();
                 $("#zhezhao").hide();
                  uexWindow.evaluateScript("", "0", "closezhezhao()");
                     
            }catch(e){
                 uexWindow.evaluateScript("", "0", "closezhezhao(1)");
                 $("#zhezhao").show();
                 toasts("暂无网络连接,请检查您的网络...")
            }
               
          },
          error: function(err) {
             appcan.window.closeToast();
             appcan.window.openToast("网络出错，请稍后重试",-1,5,0);
          }
        });
    }
</script>
</html>
